package com.usefullc.system.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.usefullc.common.domain.BaseDomain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.*;
import java.util.Date;

/**
 * Java Bean抽象实体 封装一些公用字段并且实现序列化
 */
@Data
@MappedSuperclass
public class BaseEntity extends BaseDomain {

    @ApiModelProperty(notes = "ID")
    @Id
    @org.springframework.data.annotation.Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @ApiModelProperty(notes = "数据创建时间")
    @Column(name="gmtCreate", updatable=false, columnDefinition="datetime(6)  COMMENT '数据创建时间'")
    @CreationTimestamp
    private Date gmtCreate;

    @ApiModelProperty(notes = "数据最后修改时间")
    @Column(name="gmtModified",nullable = false, columnDefinition="datetime(6)  COMMENT '数据最后修改时间'")
    @UpdateTimestamp
    private Date gmtModified;

    @ApiModelProperty(notes = "数据状态（0 不存在，1 存在）")
    @Column(name = "delState",length = 1,nullable = false,columnDefinition = "bit(1) NOT NULL DEFAULT b'1' COMMENT '数据状态（0 不存在，1 存在）'")
    private Boolean delState = true;


}
